<?php
if($_GET['action'] == 'getJSON') {
	helper_output::json(array('description'=>'我是JSON数据', 'datalist' => array('数据1', '数据2', '数据3')));
} else if($_GET['action'] == 'getHTML') {
	helper_output::html('<div>我是HTML</div>');
} else if($_GET['action'] == 'getdata') {
	helper_output::xml('我是XML数据');
}
?>

<script>
var x = new Ajax();
x.getJSON('forum.php?mod=misc&action=getJSON', function(s) {
	//JSON数据错误时,s为null
	if(s !== null) {
		//code
		alert(s);
	}
});

var x2 = new Ajax();
x2.getHTML('forum.php?mod=misc&action=getHTML', function(s) {
	//code
	alert(s);
});

var x3 = new Ajax();
x3.get('forum.php?mod=misc&action=getdata', function(s){
	alert(s);
});
</script>